package com.hejjon.core.controller;

import com.hejjon.core.bean.ResponseResult;

/**
 * 前端控制器 父类
 * @author: cs
 * @date: 2024-12-27 16:22:32
 * @since: 1.0
 */
public class BaseController {


    public ResponseResult success() {
        return ResponseResult.success();
    }

    public ResponseResult success(Object data) {
        return ResponseResult.success(data);
    }

    public ResponseResult success(String msg) {
        return ResponseResult.success(msg, null);
    }

    public ResponseResult success(String msg, Object data) {
        return ResponseResult.success(msg, data);
    }

    public ResponseResult error(String msg) {
        return ResponseResult.error(msg);
    }

    public ResponseResult error(String msg, Object data) {
        return ResponseResult.error(msg, data);
    }

    public ResponseResult warn(String msg) {
        return ResponseResult.warn(msg);
    }

    public ResponseResult warn(String msg, Object data) {
        return ResponseResult.warn(msg, data);
    }


    public ResponseResult toResult(boolean state) {
        return ResponseResult.toResult(state);
    }

    /**
     * 注意这里只需要定义成功的消息, 如果是执行失败了, 异常拦截器早就处理了
     * @param state
     * @param succMsg
     * @return
     */
    public ResponseResult toResult(boolean state, String succMsg) {
        return ResponseResult.toResult(state, succMsg);
    }

    public ResponseResult toResult(int rows) {
        return ResponseResult.toResult(rows);
    }



}
